package com.neusoft.databus.policy.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractAuditModel;

import lombok.Getter;
import lombok.Setter;

/**
 * 策略资源关联实体
 *
 * @author naxiang
 */
@Getter
@Setter
@Entity
public class PolicyRefResource extends AbstractAuditModel {
    /**
     *
     */
    private static final long serialVersionUID = 1118057548553563264L;
    /**
     * 资源编码
     */
    @Length(max = 255, message = "资源编码不能超过{max}位")
    @Column(length = 50)
    private String resourceCode;
    /**
     * 策略
     */
    @ManyToOne(targetEntity = Policy.class)
    @LazyCollection(LazyCollectionOption.FALSE)
    @JoinColumn(name = "policy_id")
    private Policy policy;
}
